<extend name="Base:base" />
<block name="main-content">
<link href="__PUBLIC__/css/store-cart.css" rel="stylesheet">
<?php  $store = session('store'); ?>
<div id="ListBox" class="box1200">
	<div class="path15">
		<a href="__APP__/Home/Food">首页</a>&nbsp;&nbsp;&nbsp;>&nbsp;&nbsp;&nbsp;<a
			href="#">购物车</a>&nbsp;&nbsp;&nbsp;>&nbsp;&nbsp;&nbsp;
	</div>
	<div class="userch_box">
		<div class="userch-img">
			<div class="por">
				<img width="35" height="35" src="{$Think.session.store.image}">
			</div>
		</div>
		<div class="userch-info">店铺名称：{$Think.session.store.account}</div>
	</div>


	<div class="ListBox" style="height: auto;">
		<div class="ListBox-cont">
			<div class="gwcBox-dd-bt0">
				<dd>
					<img src="__PUBLIC__/img/gwctoplog.png">
				</dd>
			</div>
			<div class="clear"></div>
			<div class="gwcBox-dd-bt1">
				<dd style="float: left;">
					<div class="moves">
						全部商品<span class="dd-bt1-r" id="food_num">{$count}</span>
					</div>
				</dd>
				<dd style="float: right;">
					<div></div>
					<div></div>
				</dd>
			</div>
			<div class="clear"></div>
			<div class="gwcBox-dd-bt2">
				<dd style="margin-left: 20px;">&nbsp;</dd>
				<dd style="margin-left: 70px;">商品信息</dd>
				<dd style="margin-left: 380px;">单价（元）</dd>
				<dd style="margin-left: 130px;">数量</dd>
				<dd style="margin-left: 130px;">金额</dd>
				<dd style="margin-left: 100px;">操作</dd>
			</div>
			<div class="clear"></div>
			<foreach name="dlist" item="cart" key="cdate">
			<div class="user-gwc" id="{$cdate}">
				<div class="user-gwc-top">
					<span class="text"><input class="checkAll" type="checkbox">日期:</span>
					<span class="text" style="margin: 0 20px;">{$cdate}</span>
				</div>
								<?php $i=0;?>
								<foreach name="cart" item="cart_item">
								<?php $i++;?>
									<div class="user-gwc-con {$cdate}"
					id="cart_item_{$cart_item.id}"
					<?php if($i>3) echo 'style="display: none; "';?>>
					<ul class="cart_item" id="{$cart_item.id}">
						<li class="con-p00"><input class="{$cdate}_checkbox checkbox"
							type="checkbox" id="checkbox_{$cart_item.id}"
							value="{$cart_item.cid}"></li>
						<li class="con-p01"><img src="{$cart_item.food_image}"
							alt="{$cart_item.food_name}">{$cart_item.food_name}<small style="color: gray;"><?php if($cart_item['category'] != "常规") echo "(".$cart_item['category'].")";?></small></li>
						<li class="con-p02">￥{$cart_item.price}元/{$cart_item.unit}</li>
						<li class="con-p03"><span id="cart_item_j_{$cart_item.id}"
							style="display: none;" class="btn-minus"> <img
								src="__PUBLIC__/img/j1.png">
						</span> <span> <input id="number_{$cart_item.id}"
								class="number-add" type="number" min="1" max="99"
								value="{$cart_item.num}" disabled>
						</span> <span id="cart_item_x_{$cart_item.id}"
							style="display: none;" class="btn-add"> <img
								src="__PUBLIC__/img/x1.png">
						</span></li>
						<li class="con-p04">实付:￥<span
							id="cart_item_totalprice_{$cart_item.id}">{$cart_item.price}</span>元
						</li>
						<li class="con-p05"><a href="#" class="btn-delete">删除</a></li>
					</ul>
				</div>
				<div class="clear"></div>
				</foreach>
				<if condition="$i gt 3">
				<div class="user-gwc-top" align="center">
					<a href="javascript:void(0);"><span class="text showMore">显示全部</span></a>
				</div>
				</if>
			</div>
			</foreach>
		</div>
	</div>
</div>
<!-- end row --> <!-- 删除菜单弹出框 -->
<div class="modal fade" id="myDeleteModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">删除</h4>
			</div>
			<div class="modal-body">
				<p id="sccontent" style="font-size: 15px">你确定要从购物车里删除该菜品吗？该操作不可恢复！</p>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
				<button type="button" class="btn btn-danger">确定</button>
			</div>
		</div>
	</div>
</div>
<!-- 确认订单弹出框 -->
<div class="modal fade" id="myOrderModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 900px;">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">确认订单</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal style-form" id="form_order"
					action="__APP__/Home/Cart/balance" method="post">
					<input type="hidden" id="area" name="area" value="{$Think.session.store.area}"/>
					<input type="hidden" name="address" id="address" value="{$Think.session.store.address}"/>
					<input type="hidden" name="phone" id="phone" value="{$Think.session.store.phone_number}"/>
					<div id="order_food" style="display: none;"></div>
					<div class="form-group" style="text-align: left;">
						<label class="col-sm-2 control-label">地址：<input type="hidden" name="address_id" id="address_id" value="{$Think.session.store.address_id}"/></label>
						<div class="col-sm-10 row">
							<?php $i=0;?>
							<foreach name="addresses" item="v">
							<?php $i++;?>
							<div class="col-xs-4 myaddress" <?php if($i>3) echo 'style="display: none; "';?>>
								<div id="{$v.id}"
									class="panel <?php if($v['id'] == $store["address_id"]){echo "panel-success panel-active";}else{echo "panel-default";} ?>">
									<div class="panel-heading">
										<h3 class="panel-title">{$v.area}({$v.name}收)</h3>
									</div>
									<div class="panel-body">
										{$v.address}<br />{$v.phone_number}
									</div>
								</div>
							</div>
							</foreach>
							<if condition="$i gt 3">
								<a href="javascript:void(0);"><small class="text showAddress">显示全部</small></a>
							</if>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">支付方式：</label>
						<div class="col-sm-10">
							<select class="form-control" name="payment">
								<option value="2">货到付款</option>
								<!-- <option value="1">在线支付</option> -->
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">配送时间：</label>
						<div class="col-sm-10">
							<select class="form-control" name="ptime">
								<foreach name="ptimes" item="ptime">
								<option value="{$ptime}">{$ptime}</option>
								</foreach>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">备注：</label>
						<div class="col-sm-10">
							<input type="text" name="remark" id="remark" class="form-control"
								placeholder="若无则可不填" />
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
				<button type="button" class="btn btn-danger">确定</button>
			</div>
		</div>
	</div>
</div>
<div class="cart">
	<div align="center">
		<p>
		
		
		<h2 style="color: white;">
			已选商品不含运费<span id="totalPrice" style="color: red;">0.00</span>元
		</h2>
		<button class="btn btn-warning balance" type="button">结算</button>
		</p>
	</div>
</div>
</block>
<block name="js-content"> <script type="text/javascript">
var ptime = <?php echo count($ptimes) ?>;
var totalPrice = 0;
var store = <?php echo json_encode(session('store'));  ?>;
var list = <?php echo $ilist; ?>;
//删除
var deleteUrl = "__APP__/Home/Cart/delete";
$(".userch_box").click(function(e){
	window.location.href="__APP__/Home/User";
});
$(".panel")
.mouseover(function(e){
// 	console.log("mouseover");
	$(this).removeClass("panel-default");
	$(this).addClass("panel-success");
})
.mouseout(function(e){
// 	console.log("mouseout");
	if(!$(this).hasClass("panel-active")){
		$(this).addClass("panel-default");
		$(this).removeClass("panel-success");
	}
})
.click(function(e){
	$('#address_id').val(this.id);
	$('.panel-active').removeClass("panel-success");
	$('.panel-active').addClass("panel-default");
	$('.panel-active').removeClass("panel-active");
	$(this).removeClass("panel-default");
	$(this).addClass("panel-success");
	$(this).addClass("panel-active");
});
//显示全部
$('.showAddress').click(function(e){
	$(".myaddress").show();
	$(this).remove();
});
$("#area").val(store['area']);
</script> <script type="text/javascript"
	src="__PUBLIC__/js/store/cart.js"></script> </block>